#ifndef _SERIALIZABLE_H
#define _SERIALIZABLE_H

#include <iostream>

//Any object that needs to be serialized needs to extend this
//If the object that needs to be serialized is a base class, define this in its extended classes only

//Easy #define
//You probabbly don't want to use this, convert to network format within this as well
#define SERIALIZE_DATA(x)	virtual void SerializeToBuffer  (char *dest)  { x.Copy(dest);  } \
							virtual void SerializeFromBuffer(char *source){ x.Set(source); } \
							virtual int  GetSize() { return x.GetSize(); }

struct Serializable
{
	virtual ~Serializable() {}
	virtual void SerializeToBuffer( char *dest ) = 0;
	virtual void SerializeFromBuffer( char *source ) = 0;
	virtual int  GetSize() = 0;
};

char *operator <<(char *dest, Serializable &source);

char *operator >>(char *source, Serializable &dest);

#endif